package org.mch.func.file.fileread;

import java.awt.BorderLayout;
import java.awt.Font;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.border.SoftBevelBorder;

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.mch.biz.ui.FuncEvent;
import org.mch.biz.ui.FuncPanel;
import org.mch.swingm.ext.METextChooser;
import org.mch.swingm.ext.METextField;

public class ClientPanel extends FuncPanel {
	private static final long serialVersionUID = -2624599150471418179L;

	private JSplitPane splitPane;
	private JPanel panel;
	private JPanel panel_1;
	private JScrollPane scrollPane;
	private RSyntaxTextArea textArea_up;
	private JButton btn_FileName;
	private JCheckBox chckbx_file;
	private JCheckBox chckbx_folder;
	private METextField text_prefix;
	private METextChooser text_path;
	private METextField text_suffix;
	private JCheckBox chckbx_search_child;
	private METextField text_like;
	private JCheckBox chckbx_outfilepath;

	public ClientPanel() {
		initComponents();
	}

	private void initComponents() {
		setLayout(new BorderLayout(0, 0));
		add(getSplitPane(), "Center");
	}

	public JSplitPane getSplitPane() {
		if (this.splitPane == null) {
			this.splitPane = new JSplitPane();
			splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
			this.splitPane.setLeftComponent(getPanel());
			this.splitPane.setRightComponent(getPanel_1());
			this.splitPane.setDividerLocation(200);
		}
		return this.splitPane;
	}

	public JPanel getPanel() {
		if (this.panel == null) {
			this.panel = new JPanel();
			this.panel.setLayout(null);
			panel.add(getBtn_FileName());
			panel.add(getChckbx_file());
			panel.add(getChckbx_folder());
			panel.add(getText_prefix());
			panel.add(getText_path());
			panel.add(getText_suffix());
			panel.add(getChckbx_search_child());
			panel.add(getText_like());
			panel.add(getChckbx_outfilepath());
		}
		return this.panel;
	}

	public JPanel getPanel_1() {
		if (this.panel_1 == null) {
			this.panel_1 = new JPanel();
			panel_1.setLayout(new BorderLayout(0, 0));
			panel_1.add(getScrollPane());
		}
		return this.panel_1;
	}

	public JScrollPane getScrollPane() {
		if (this.scrollPane == null) {
			this.scrollPane = new JScrollPane();
			this.scrollPane.setViewportView(getTextArea_up());
		}
		return this.scrollPane;
	}

	public RSyntaxTextArea getTextArea_up() {
		if (this.textArea_up == null) {
			this.textArea_up = new RSyntaxTextArea();
			textArea_up.setFont(new Font("宋体", Font.PLAIN, 13));
			this.textArea_up.setBorder(new SoftBevelBorder(1, null, null, null, null));
		}
		return this.textArea_up;
	}

	protected FuncEvent createEvent() {
		return new ClientEvent(this);
	}

	public JButton getBtn_FileName() {
		if (btn_FileName == null) {
			btn_FileName = new JButton("\u8BFB\u53D6");
			btn_FileName.setFont(new Font("宋体", Font.PLAIN, 12));
			btn_FileName.setBounds(520, 121, 58, 34);
			btn_FileName.addActionListener(getEvent());
		}
		return btn_FileName;
	}

	public JCheckBox getChckbx_file() {
		if (chckbx_file == null) {
			chckbx_file = new JCheckBox("\u5305\u542B\u6587\u4EF6");
			chckbx_file.setFont(new Font("宋体", Font.PLAIN, 12));
			chckbx_file.setSelected(true);
			chckbx_file.setBounds(517, 95, 115, 23);
		}
		return chckbx_file;
	}

	public JCheckBox getChckbx_folder() {
		if (chckbx_folder == null) {
			chckbx_folder = new JCheckBox("\u5305\u542B\u6587\u4EF6\u5939");
			chckbx_folder.setFont(new Font("宋体", Font.PLAIN, 12));
			chckbx_folder.setSelected(true);
			chckbx_folder.setBounds(517, 71, 115, 23);
		}
		return chckbx_folder;
	}

	public METextField getText_prefix() {
		if (text_prefix == null) {
			text_prefix = new METextField();
			text_prefix.getLabel().setText("输出前缀：");
			text_prefix.setFont(new Font("宋体", Font.PLAIN, 12));
			text_prefix.setBounds(10, 48, 502, 34);
		}
		return text_prefix;
	}

	public METextChooser getText_path() {
		if (text_path == null) {
			text_path = new METextChooser("目录：",METextChooser.SELECT_FOLDER);
			text_path.setFont(new Font("宋体", Font.PLAIN, 12));
			text_path.setBounds(10, 10, 842, 34);
		}
		return text_path;
	}

	public METextField getText_suffix() {
		if (text_suffix == null) {
			text_suffix = new METextField();
			text_suffix.getLabel().setText("输出后缀：");
			text_suffix.setFont(new Font("宋体", Font.PLAIN, 12));
			text_suffix.setBounds(10, 84, 502, 34);
		}
		return text_suffix;
	}

	public JCheckBox getChckbx_search_child() {
		if (chckbx_search_child == null) {
			chckbx_search_child = new JCheckBox("是否搜索子文件夹");
			chckbx_search_child.setFont(new Font("宋体", Font.PLAIN, 12));
			chckbx_search_child.setBounds(517, 48, 136, 23);
			chckbx_search_child.setSelected(false);
		}
		return chckbx_search_child;
	}

	public METextField getText_like() {
		if (text_like == null) {
			text_like = new METextField();
			text_like.getLabel().setToolTipText("根据输入内容，模糊筛选文件名！");
			text_like.setToolTipText("");
			text_like.getLabel().setText("模糊筛选：");
			text_like.setFont(new Font("宋体", Font.PLAIN, 12));
			text_like.setBounds(10, 121, 502, 34);
		}
		return text_like;
	}

	public JCheckBox getChckbx_outfilepath() {
		if (chckbx_outfilepath == null) {
			chckbx_outfilepath = new JCheckBox("是否输出完整路径名称");
			chckbx_outfilepath.setFont(new Font("宋体", Font.PLAIN, 12));
			chckbx_outfilepath.setBounds(657, 47, 154, 23);
			chckbx_outfilepath.setSelected(false);
		}
		return chckbx_outfilepath;
	}
}